﻿using Evolution.Application.SharedKernel;
using Evolution.Application.SharedKernel.Actions.Bootstrappers;
using Evolution.Application.SharedKernel.Actions.Helpers;
using Evolution.Application.SharedKernel.Tests.Core;
using Evolution.Application.SharedKernel.Tests.Core.Actions.Helpers;
using Evolution.Application.SharedKernel.Tests.Core.Authorisation;
using Evolution.Application.SharedKernel.Tests.Core.Services;
using Evolution.Sdk;
using Evolution.Sdk.Authorisation;
using Evolution.Sdk.Commands;
using Evolution.Sdk.Container;
using Evolution.Sdk.Logging;

namespace Evolution.Client.ImportData.Infrastructure
{
    public class ImportActionsDependencyBootstrapper : SharedKernelActionBootstrapper
    {
        private IResolveDependencies resolveDependencies;

        public ImportActionsDependencyBootstrapper(IRegisterDependencies dependencyResolver, IResolveDependencies resolveDependencies)
            : base(dependencyResolver)
        {
            this.resolveDependencies = resolveDependencies;
        }

        public override void WireUp()
        {
            base.WireUp();

            this.DependencyResolverConfiguration.RegisterSingleton<ILanguageService, TestLanguageService>();
            this.DependencyResolverConfiguration.RegisterSingleton<IAuthorisationProvider, TestAuthorisationProvider>();
            this.DependencyResolverConfiguration.RegisterSingleton<IUserContextHelper, TestUserContextHelper>();
            this.DependencyResolverConfiguration.RegisterSingleton<ILogProvider, TestLogProvider>();

            var messageFormatter = new JsonMessageFormatter();
            this.DependencyResolverConfiguration.RegisterInstance<ICommandBus>(new DefaultCommandBus(this.resolveDependencies, messageFormatter));
        }
    }
}
